# -*- coding:utf-8 -*-
# @Time: 2020/9/17 21:54
# @Author: 周铖鑫
# @Description：tick能见度，放置线条等绘制的图像把坐标轴挡住
# @File: tickVisibility.py
import  matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-3,3,50)
y=0.1*x
plt.figure()
#zorder层级
plt.plot(x,y,linewidth=10,zorder=1)
plt.ylim(-2,2)
ax=plt.gca()
#spines上下左右边框
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.spines['bottom'].set_position(('data',0))
ax.spines['left'].set_position(('data',0))
#为每个标签设置一个边框（透明）
for label in ax.get_xticklabels()+ax.get_yticklabels():
    label.set_fontsize(12)
    #alpha为透明度
    label.set_bbox(dict(facecolor='white',edgecolor='None',alpha=0.7))
plt.show()